﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace Tradex.Trading {

    /// <summary>
    /// The PositionUpdate class contains the total position information.
    /// </summary>
    public class PositionUpdate {

        /// <summary>
        /// Constructor taking all parameters.
        /// </summary>
        /// <param name="timestamp"></param>
        /// <param name="instrument"></param>
        /// <param name="market"></param>
        /// <param name="quantity"></param>
        /// <param name="fillPrice"></param>
        public PositionUpdate(
            DateTime timestamp,
            string instrument, string market,
            int quantity, double fillPrice
        ) {
            Timestamp = timestamp;
            Instrument = instrument;
            Market = market;
            Quantity = quantity;
            FillPrice = fillPrice;

        }

        /// <summary>
        /// Gets the Timetamp of the Update.
        /// </summary>
        public DateTime Timestamp { get; private set; }
      
        /// <summary>
        /// Gets the Instrument.
        /// </summary>
        public string Instrument { get; private set; }

        /// <summary>
        /// Gets the Market.
        /// </summary>
        public string Market { get; private set; }

        /// <summary>
        /// Gets the Fillprice of the Update.
        /// </summary>
        public double FillPrice { get; private set; }

        /// <summary>
        /// Gets the Quantity of the Update.
        /// </summary>
        public int Quantity { get; private set; }

        /// <inheritdoc />
        public override string ToString() {
            return String.Format(
                CultureInfo.InvariantCulture, "{0} @ {1}: {2} @ {3}",
                Instrument, Market, Quantity, FillPrice
            );
        }

    }

}
